import java.io.File;
import java.io.IOException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.sql.Connection;
import java.sql.DriverManager;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
import org.parosproxy.paros.control.Control;
import org.parosproxy.paros.network.SSLConnector;

import com.bluestone.action.JDBCAction;
import com.bluestone.action.Section508aAction;
import com.bluestone.assertor.LoggingAssertor;
import com.bluestone.scripts.ActionScript;
import com.bluestone.util.Util;


public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try{
			
			//new Test().testJdbc();
			String url = "06%2F04%2F2010";
			String url1 = "06%252F04%252F2010";
			System.out.println(URLEncoder.encode(url,"iso8859-1"));
			System.out.println(URLDecoder.decode(url));

			
			
			/*
			Action action = new Action();
			action.setTarget("D:\\ACA\\aca.dev\\trunk");
			action.setValue("section508a_ACA.html");
			action.setCond(".aspx,.js,.cs,.java,.cfm,.htm,.html,.jsp,.xml,.css,.tld,.txt");
			Section508aAction a = new Section508aAction(action);
			a.execute(null);
			*/
			/*
			Action action1 = new Action();
			action1.setTarget("D:\\AA7.0.0\\main-dev\\ui\\portlets\\src\\ui\\WEB-INF\\tiles");
			action1.setValue("section508a_AA.html");
			action1.setCond(".xml");
			//action1.setCond(".aspx,.js,.cs,.java,.cfm,.htm,.html,.jsp,.xml,.css,.tld,.txt");
			Section508aAction b= new Section508aAction(action1);
			b.execute(null);
			*/
						
		}catch(Exception me){
			me.printStackTrace();
		}  


	}
	
	
	public void testHttpsProxy(){
		try{
		    // set SSLConnector as socketfactory in HttpClient.
		    ProtocolSocketFactory sslFactory = null;
		    try {
		        Protocol protocol = Protocol.getProtocol("https");
		        sslFactory = protocol.getSocketFactory();
		    } catch (Exception e) {}
		    if (sslFactory == null || !(sslFactory instanceof SSLConnector)) {
		        Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new SSLConnector(), 443));
		    }		 
		 Control.initSingletonWithoutView();
		 Control.getSingleton().getProxy().startServer();
		 long l = System.currentTimeMillis();
		 while(true){
			 if(System.currentTimeMillis() - l >1000 * 60 * 2){
				 break;
			 }
		 }


		}catch(Exception me){
			me.printStackTrace();
		}  
		
	}
	public void testJdbc(){
		
		try{
			Util.getDynamicParaMap().put("jdbc.dirver", "oracle.jdbc.driver.OracleDriver");
			Util.getDynamicParaMap().put("jdbc.url", "jdbc:oracle:thin:@10.50.0.107:1521:dbs107");
			Util.getDynamicParaMap().put("jdbc.user", "aaauto700mir2");
			Util.getDynamicParaMap().put("jdbc.password", "aaauto700mir2");
			
			ActionScript action = new ActionScript();
			//action.setValue("INSERT INTO  CALENDAR_EVENT(SERV_PROV_CODE,EVENT_ID,CALENDAR_ID,EVENT_TYPE,START_DATE,END_DATE,REC_DATE,REC_FUL_NAM,REC_STATUS,EVENT_NAME)  VALUES('AIVRREF',((SELECT MAX(EVENT_ID) FROM CALENDAR_EVENT)+1),(SELECT CALENDAR_ID FROM CALENDAR WHERE SERV_PROV_CODE='AIVRREF' AND CALENDAR_NAME='AIVRAutoTestCalendar'),'Holiday',to_date('2010-04-19 00:00:00','yyyy-mm-dd hh24:mi:ss'),to_date('2010-04-19 23:59:00','yyyy-mm-dd hh24:mi:ss'),to_date('2010-01-08 00:00:00','yyyy-mm-dd hh24:mi:ss'),'ADMIN','A','Holiday')");
			  action.setPara("value", "INSERT INTO   CALENDAR_EVENT(SERV_PROV_CODE,EVENT_ID,CALENDAR_ID,EVENT_TYPE,START_DATE,END_DATE,REC_DATE,REC_FUL_NAM,REC_STATUS,EVENT_NAME)  VALUES('AIVRREF',(SELECT MAX(EVENT_ID) FROM CALENDAR_EVENT)+1,(SELECT CALENDAR_ID FROM CALENDAR WHERE SERV_PROV_CODE='AIVRREF' AND CALENDAR_NAME='AIVRAutoTestCalendar'),'Holiday',to_date('2010-04-19 00:00:00','yyyy-mm-dd hh24:mi:ss'),to_date('2010-04-19 23:59:00','yyyy-mm-dd hh24:mi:ss'),to_date('2010-01-08 00:00:00','yyyy-mm-dd hh24:mi:ss'),'ADMIN','A','Holiday')");
			JDBCAction jaction = new JDBCAction(action);
			jaction.execute(null);


		}catch(Exception me){
			me.printStackTrace();
		}  		
	}

}
